package com.itheima.pattern.prototype.test1;

import java.io.*;

/**
 * 深克隆
 */
public class CitationTest{
    public static void main(String[] args) throws Exception{
        Citation c1 = new Citation();

        Student s1 = new Student();
        s1.setName("柳淇");
        c1.setStudent(s1);

        //创建对象输出流对象
        ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("d:/a.txt"));
        oos.writeObject(c1);
        oos.close();

        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("d:/a.txt"));
        Citation c2 = (Citation) ois.readObject();
        ois.close();

        Student student = c2.getStudent();
        student.setName("张三");

        c1.show();
        c2.show();


    }
}
